<template>
    <div>
      <div class="demo-input-size">
          &nbsp;&nbsp;<el-button type="primary" size="small" @click="addVisible = true">添加</el-button>&nbsp;
          <el-button type="primary" size="small" @click="dels">批量删除</el-button>&nbsp;
          求租人:<el-input v-model="contact" placeholder="求租人" size="small" :style="{width: '150px'}"></el-input>&nbsp;
          商店类型:<el-select v-model="management" clearable placeholder="全部">
            <el-option
              v-for="item in managementOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
              </el-option>
          </el-select>&nbsp;
          <el-button type="primary" size="small" icon="el-icon-search" @click="Show()">搜索</el-button>
      </div>
        <el-table
        ref="multipleTable"
        :data="DataTable"
        tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="45"></el-table-column>
        <el-table-column prop="id" label="ID" width="45"></el-table-column>
        <el-table-column prop="contact" label="求租人" width="70" show-overflow-tooltip></el-table-column>
        <el-table-column prop="telephone" label="联系电话" width="80" show-overflow-tooltip></el-table-column>
        <el-table-column prop="region" label="求租区域" width="80" show-overflow-tooltip></el-table-column>
        <el-table-column prop="address" label="详细地址" width="80" show-overflow-tooltip></el-table-column>
        <el-table-column prop="type" label="商铺地段" width="80" :formatter="typefgf" show-overflow-tooltip></el-table-column>
        <el-table-column prop="management" label="商店类型" width="80" :formatter="managementfgf" show-overflow-tooltip></el-table-column>
        <el-table-column prop="requirement" label="商铺装潢" width="80" :formatter="requirementfgf" show-overflow-tooltip></el-table-column>
        <el-table-column prop="title" label="信息标题" width="80" show-overflow-tooltip></el-table-column>
        <el-table-column prop="maxArea" label="最大求租面积" width="80" show-overflow-tooltip></el-table-column>
        <el-table-column prop="minArea" label="最小求租面积" width="80" show-overflow-tooltip></el-table-column>
        <el-table-column prop="price" label="转让价格" width="80" :formatter="pricefgf" show-overflow-tooltip></el-table-column>
        <el-table-column prop="mode" label="录入方式" width="80" :formatter="modefgf" show-overflow-tooltip></el-table-column>
        <el-table-column prop="isShow" label="是否发布" width="80" :formatter="isShowfgf" show-overflow-tooltip></el-table-column>
        <el-table-column prop="isDeal" label="是否成交" width="80" :formatter="isDealfgf" show-overflow-tooltip></el-table-column>
        <el-table-column prop="createdDate" label="发布日期" width="80" show-overflow-tooltip></el-table-column>
        <el-table-column prop="modifiedDate" label="更新日期" width="80" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作">
          <template #default="scope">
            <el-button size="mini" type="primary" @click="handleEdit(scope.$index, scope.row), editVisible = true">编辑</el-button>
            <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="block">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="pageIndex"
          :page-sizes="[1, 2, 3, 5]"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="pageTotal">
        </el-pagination>
      </div>
        <el-dialog v-bind="$attrs" title="添加" v-model="addVisible">
            <el-form ref="elForm" :model="Addform" :rules="rules" size="medium" label-width="100px">
                <el-row :gutter="15">
                    <el-col :span="11">
                        <el-form-item label="求租人姓名" prop="contact">
                            <el-input v-model="Addform.contact" placeholder="请输入租人姓名" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="15">
                        <el-form-item label="客户ID" prop="customerId">
                            <el-input v-model="Addform.customerId" placeholder="请输入客户ID" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="绑定用户" prop="bindUser">
                            <el-input v-model="Addform.bindUser" placeholder="请输入绑定用户" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="联系电话" prop="telephone">
                            <el-input v-model="Addform.telephone" placeholder="请输入联系电话" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="求租区域" prop="region">
                            <el-input v-model="Addform.region" placeholder="请输入求租区域" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="详细地址" prop="address">
                            <el-input v-model="Addform.address" placeholder="请输入详细地址" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="15">
                        <el-form-item label="信息标题" prop="title">
                            <el-input v-model="Addform.title" placeholder="请输入信息标题" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="最小求租面积" prop="minArea">
                            <el-input v-model="Addform.minArea" placeholder="请输入最小求租面积" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="最大求租面积" prop="maxArea">
                            <el-input v-model="Addform.maxArea" placeholder="请输入最大求租面积" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="商店类型" prop="management">
                            <el-select v-model="Addform.management" clearable placeholder="全部">
                                <el-option
                                    v-for="item in managementOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="转让费" prop="price">
                            <el-select v-model="Addform.price" clearable placeholder="全部">
                                <el-option
                                    v-for="item in priceOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="15">
                        <el-form-item label="适合经营" prop="best">
                        <el-input v-model="Addform.best" placeholder="请输入适合经营的相关内容" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="是否急转" prop="isEmergency">
                            <el-select v-model="Addform.isEmergency" clearable placeholder="全部">
                                <el-option
                                    v-for="item in isEmergencyOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="是否盖章" prop="isSeal">
                            <el-select v-model="Addform.isSeal" clearable placeholder="全部">
                                <el-option
                                    v-for="item in isSealOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="商铺装潢" prop="requirement">
                            <el-select v-model="Addform.requirement" clearable placeholder="全部">
                                <el-option
                                    v-for="item in requirementOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="商铺地段" prop="type">
                            <el-select v-model="Addform.type" clearable placeholder="全部">
                                <el-option
                                    v-for="item in typeOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="排序" prop="sort">
                            <el-input v-model="Addform.sort" placeholder="请输入排序" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="是否发布" prop="isShow">
                            <el-select v-model="Addform.isShow" clearable placeholder="全部">
                                <el-option
                                    v-for="item in isShowOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="是否成交" prop="isDeal">
                            <el-select v-model="Addform.isDeal" clearable placeholder="全部">
                                <el-option
                                    v-for="item in isDealOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="15">
                        <el-form-item label="详细介绍" prop="introduce">
                            <el-input
                              v-model="Addform.introduce"
                              :rows="2"
                              type="textarea"
                              placeholder="请输入内容"
                            />
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="租金不超过" prop="rentMoney">
                            <el-select v-model="Addform.rentMoney" clearable placeholder="全部">
                                <el-option
                                    v-for="item in rentMoneyOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="录入模式" prop="mode">
                            <el-select v-model="Addform.mode" clearable placeholder="全部">
                                <el-option
                                    v-for="item in modeOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="状态" prop="status">
                            <el-select v-model="Addform.status" clearable placeholder="全部">
                                <el-option
                                    v-for="item in statusOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-form-item size="large">
                    <el-button type="primary" @click="submitFormAdd">提交</el-button>
                    <el-button @click="resetForm">重置</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>
        <el-dialog v-bind="$attrs" title="修改" v-model="editVisible">
            <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px">
                <el-row :gutter="15">
                    <el-col :span="11">
                        <el-form-item label="求租人姓名" prop="contact">
                            <el-input v-model="formData.contact" placeholder="请输入租人姓名" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="15">
                        <el-form-item label="客户ID" prop="customerId">
                            <el-input v-model="formData.customerId" placeholder="请输入客户ID" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="绑定用户" prop="bindUser">
                            <el-input v-model="formData.bindUser" placeholder="请输入绑定用户" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="联系电话" prop="telephone">
                            <el-input v-model="formData.telephone" placeholder="请输入联系电话" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="求租区域" prop="region">
                            <el-input v-model="formData.region" placeholder="请输入求租区域" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="详细地址" prop="address">
                            <el-input v-model="formData.address" placeholder="请输入详细地址" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="15">
                        <el-form-item label="信息标题" prop="title">
                            <el-input v-model="formData.title" placeholder="请输入信息标题" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="最小求租面积" prop="minArea">
                            <el-input v-model="formData.minArea" placeholder="请输入最小求租面积" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="最大求租面积" prop="maxArea">
                            <el-input v-model="formData.maxArea" placeholder="请输入最大求租面积" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="商店类型" prop="management">
                            <el-select v-model="formData.management" clearable placeholder="全部">
                                <el-option
                                    v-for="item in managementOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="转让费" prop="price">
                            <el-select v-model="formData.price" clearable placeholder="全部">
                                <el-option
                                    v-for="item in priceOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="15">
                        <el-form-item label="适合经营" prop="best">
                        <el-input v-model="formData.best" placeholder="请输入适合经营的相关内容" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="是否急转" prop="isEmergency">
                            <el-select v-model="formData.isEmergency" clearable placeholder="全部">
                                <el-option
                                    v-for="item in isEmergencyOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="是否盖章" prop="isSeal">
                            <el-select v-model="formData.isSeal" clearable placeholder="全部">
                                <el-option
                                    v-for="item in isSealOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="商铺装潢" prop="requirement">
                            <el-select v-model="formData.requirement" clearable placeholder="全部">
                                <el-option
                                    v-for="item in requirementOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="商铺地段" prop="type">
                            <el-select v-model="formData.type" clearable placeholder="全部">
                                <el-option
                                    v-for="item in typeOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="排序" prop="sort">
                            <el-input v-model="formData.sort" placeholder="请输入排序" clearable :style="{width: '100%'}"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="是否发布" prop="isShow">
                            <el-select v-model="formData.isShow" clearable placeholder="全部">
                                <el-option
                                    v-for="item in isShowOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="是否成交" prop="isDeal">
                            <el-select v-model="formData.isDeal" clearable placeholder="全部">
                                <el-option
                                    v-for="item in isDealOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="15">
                        <el-form-item label="详细介绍" prop="introduce">
                            <el-input
                              v-model="formData.introduce"
                              :rows="2"
                              type="textarea"
                              placeholder="请输入内容"
                            />
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="租金不超过" prop="rentMoney">
                            <el-select v-model="formData.rentMoney" clearable placeholder="全部">
                                <el-option
                                    v-for="item in rentMoneyOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="录入模式" prop="mode">
                            <el-select v-model="formData.mode" clearable placeholder="全部">
                                <el-option
                                    v-for="item in modeOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="状态" prop="status">
                            <el-select v-model="formData.status" clearable placeholder="全部">
                                <el-option
                                    v-for="item in statusOptions"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-form-item size="large">
                    <el-button type="primary" @click="saveEdit">提交</el-button>
                    <el-button @click="resetForm">重置</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>
    </div>
</template>


<script>
import { ShowRent,getRent,updateRent,deleRent,addRent } from "../../api/rent.js"
export default {
    name: "RentShow",
    data() {
        return {
            multipleSelection: [],
            delList: [],
            delLists: [],
            addVisible: false,
            editVisible: false,
            contact: "",
            management: '',
            pageIndex: 1,
            pageSize: 3,
            pageTotal: 0,
            DataTable: [],
            Addform: {
                customerId: 0,
                type: 1,
                requirement: 1,
                title: "",
                address: "",
                region: "",
                minArea: "",
                maxArea: "",
                price: 1,
                rentMoney: 1,
                mode: 1,
                management: 1,
                contact: "",
                telephone: "",
                bindUser: "",
                isEmergency: 1,
                isSeal: 1,
                isDeal: 1,
                introduce: "",
                sort: 0,
                status: 1,
                best: "",
                isShow: 1,
            },
            formData: {
                id: "",
                customerId: "",
                type: "",
                requirement: "",
                title: "",
                address: "",
                region: "",
                minArea: "",
                maxArea: "",
                price: "",
                rentMoney: "",
                mode: "",
                management: "",
                contact: "",
                telephone: "",
                bindUser: "",
                isEmergency: "",
                isSeal: "",
                isDeal: "",
                introduce: "",
                sort: "",
                status: "",
                best: "",
                isShow: ""
            },
            TypeOptions: [{
                value: "1",
                label: "沿街商铺",
            },{
                value: "2",
                label: "商场商铺",
            },{
                value: "3",
                label: "社区商铺",
            }],
            RequirementOptions: [{
                value: "1",
                label: "空装"
            }, {
                value: "2",
                label: "带装修"
            }, {
                value: "3",
                label: "不限"
            }],
            PriceOptions: [{
                value: "1",
                label: "5万以上"
            }, {
                value: "2",
                label: "10万以内"
            }, {
                value: "3",
                label: "25万以内"
            }, {
                value: "4",
                label: "50万以内"
            }, {
                value: "5",
                label: "100万以内"
            }, {
                value: "6",
                label: "100万以上"
            }],
            RentMoneyOptions: [{
                value: "1",
                label: "元/月"
            }, {
                value: "2",
                label: "元/季"
            }, {
                value: "3",
                label: "元/年"
            }, {
                value: "4",
                label: "元/平方"
            }, {
                value: "5",
                label: "元/不限"
            }],
            ModeOptions: [{
                value: "1",
                label: "前台"
            }, {
                value: "2",
                label: "后台"
            }],
            ManagementOptions: [{
                value: "1",
                label: "酒楼餐饮"
            }, {
                value: "2",
                label: "服装鞋包"
            }, {
                value: "3",
                label: "美容美发"
            }, {
                value: "4",
                label: "百货超市"
            }, {
                value: "5",
                label: "娱乐休闲"
            }, {
                value: "6",
                label: "汽修美容"
            }, {
                value: "7",
                label: "生活服务"
            }, {
                value: "8",
                label: "空铺转让"
            }],
            IsEmergencyOptions: [{
                value: "1",
                label: "是"
            }, {
                value: "2",
                label: "否"
            }],
            IsSealOptions: [{
                value: "1",
                label: "是"
            }, {
                value: "2",
                label: "否"
            }],
            IsDealOptions: [{
                value: "1",
                label: "是"
            }, {
                value: "2",
                label: "否"
            }],
            StatusOptions: [{
                value: "1",
                label: "在职"
            }, {
                value: "2",
                label: "离职"
            }],
            IsShowOptions: [{
                value: "1",
                label: "发布"
            }, {
                value: "2",
                label: "不发布"
            }],
            typeOptions: [{
                "value": 1,
                "label": "沿街商铺",
            },{
                "value": 2,
                "label": "商场商铺",
            },{
                "value": 3,
                "label": "社区商铺",
            }],
            requirementOptions: [{
                "value": 1,
                "label": "空装"
            }, {
                "value": 2,
                "label": "带装修"
            }, {
                "value": 3,
                "label": "不限"
            }],
            priceOptions: [{
                "value": 1,
                "label": "5万以上"
            }, {
                "value": 2,
                "label": "10万以内"
            }, {
                "value": 3,
                "label": "25万以内"
            }, {
                "value": 4,
                "label": "50万以内"
            }, {
                "value": 5,
                "label": "100万以内"
            }, {
                "value": 6,
                "label": "100万以上"
            }],
            rentMoneyOptions: [{
                "value": 1,
                "label": "元/月"
            }, {
                "value": 2,
                "label": "元/季"
            }, {
                "value": 3,
                "label": "元/年"
            }, {
                "value": 4,
                "label": "元/平方"
            }, {
                "value": 5,
                "label": "元/不限"
            }],
            modeOptions: [{
                "value": 1,
                "label": "前台"
            }, {
                "value": 2,
                "label": "后台"
            }],
            managementOptions: [{
                "value": 1,
                "label": "酒楼餐饮"
            }, {
                "value": 2,
                "label": "服装鞋包"
            }, {
                "value": 3,
                "label": "美容美发"
            }, {
                "value": 4,
                "label": "百货超市"
            }, {
                "value": 5,
                "label": "娱乐休闲"
            }, {
                "value": 6,
                "label": "汽修美容"
            }, {
                "value": 7,
                "label": "生活服务"
            }, {
                "value": 8,
                "label": "空铺转让"
            }],
            isEmergencyOptions: [{
                "value": 1,
                "label": "是"
            }, {
                "value": 2,
                "label": "否"
            }],
            isSealOptions: [{
                "value": 1,
                "label": "是"
            }, {
                "value": 2,
                "label": "否"
            }],
            isDealOptions: [{
                "value": 1,
                "label": "是"
            }, {
                "value": 2,
                "label": "否"
            }],
            statusOptions: [{
                "value": 1,
                "label": "在职"
            }, {
                "value": 2,
                "label": "离职"
            }],
            isShowOptions: [{
                "value": 1,
                "label": "发布"
            }, {
                "value": 2,
                "label": "不发布"
            }]
        };
    },
    methods: {
        typefgf(row) {
          if (row.type == "1") {
            return <span>沿街商铺</span>;
          } else if (row.type == "2") {
            return <span>商场商铺</span>;
          } else if (row.type == "3") {
            return <span>社区商铺</span>;
          }
        },
        requirementfgf(row) {
          if (row.requirement == "1") {
            return <span>空装</span>;
          } else if (row.requirement == "2") {
            return <span>带装修</span>;
          } else if (row.requirement == "3") {
            return <span>不限</span>;
          }
        },
        pricefgf(row) {
          if (row.price == "1") {
            return <span>5万以上</span>;
          } else if (row.price == "2") {
            return <span>10万以内</span>;
          } else if (row.price == "3") {
            return <span>25万以内</span>;
          } else if (row.price == "4") {
            return <span>50万以内</span>;
          } else if (row.price == "5") {
            return <span>100万以内</span>;
          } else if (row.price == "6") {
            return <span>100万以上</span>;
          }
        },
        rentMoneyfgf(row) {
          if (row.rentMoney == "1") {
            return <span>元/月</span>;
          } else if (row.rentMoney == "2") {
            return <span>元/季</span>;
          } else if (row.rentMoney == "3") {
            return <span>元/年</span>;
          } else if (row.rentMoney == "4") {
            return <span>元/平方</span>;
          } else if (row.rentMoney == "5") {
            return <span>元/不限</span>;
          }
        },
        modefgf(row) {
          if (row.mode == "1") {
            return <span>前台</span>;
          } else if (row.mode == "2") {
            return <span>后台</span>;
          }
        },
        managementfgf(row) {
          if (row.management == "1") {
            return <span>酒楼餐饮</span>;
          } else if (row.management == "2") {
            return <span>服装鞋包</span>;
          } else if (row.management == "3") {
            return <span>美容美发</span>;
          } else if (row.management == "4") {
            return <span>百货超市</span>;
          } else if (row.management == "5") {
            return <span>娱乐休闲</span>;
          } else if (row.management == "6") {
            return <span>汽修美容</span>;
          } else if (row.management == "7") {
            return <span>生活服务</span>;
          } else if (row.management == "8") {
            return <span>空铺转让</span>;
          }
        },
        isEmergencyfgf(row) {
          if (row.isDeal == "1") {
            return <span>是</span>;
          } else if (row.isDeal == "2") {
            return <span>否</span>;
          }
        },
        isSealfgf(row) {
          if (row.isDeal == "1") {
            return <span>是</span>;
          } else if (row.isDeal == "2") {
            return <span>否</span>;
          }
        },
        isDealfgf(row) {
          if (row.isDeal == "1") {
            return <span>是</span>;
          } else if (row.isDeal == "2") {
            return <span>否</span>;
          }
        },
        statusfgf(row) {
          if (row.status == "1") {
            return <span>在职</span>;
          } else if (row.status == "2") {
            return <span>离职</span>;
          }
        },
        isShowfgf(row) {
          if (row.isShow == "2") {
            return <span>不发布</span>;
          } else if (row.isShow == "1") {
            return <span>发布</span>;
          }
        },
      Show() {
        ShowRent({
            Contact: this.contact,
            Management: 0+this.management,
            PageSize: this.pageSize,
            PageIndex: this.pageIndex,
        }).then((res) => {
          console.log(res.data);
          this.DataTable = res.data.pagedData;
          this.pageTotal=res.data.totalCount;
          console.log(this.DataTable);
        });
      },
      //添加操作
      submitFormAdd() {
        addRent(this.Addform)
        .then((res) => {
          console.log(res.code);
          if(res.code>0)
          {
            alert("添加成功");
            this.Show();
          }
          else{
            alert("添加失败");
          }
        });
        this.addVisible = false;
      },
      //重置功能
      resetForm() {
        this.$refs['elForm'].resetFields();
      },
      //删除操作
      handleDelete(index,row) {
        alert(row.id);
        deleRent({
          objId:row.id
        }).then((res) => {
          console.log(res);
          if (res.code == 1) {
            alert("删除成功");
            this.Show();
          } else {
            alert("删除失败");
            this.Show();
          }
        });
      },
      dels(){
            for(var i=0;i<this.multipleSelection.length;i++){
                this.delLists.push(this.multipleSelection[i].id);
            }
            alert(this.delLists);
            if(confirm("请确认是否进行删除!!!")){
                deleRent({
                objId: 0+this.delLists,
                }).then((res) => {
                console.log(res);
                if (res.code == 1) {
                    alert("批量删除成功");
                    this.Show();
                } else {
                    alert("批量删除失败");
                    this.Show();
                }
            });
        }
        this.delLists=[];
      },
      // 多选操作
      handleSelectionChange(val) {
        this.multipleSelection = val;
      },
      delAllSelection() {
        const length = this.multipleSelection.length;
        let str = "";
        this.delList = this.delList.concat(this.multipleSelection);
        for (let i = 0; i < length; i++) {
          str += this.multipleSelection[i].name + " ";
        }
        this.$message.error(`删除了${str}`);
        this.multipleSelection = [];
      },
      // 修改操作
      handleEdit(index, row) {
            getRent({
                id:row.id
            })
            .then((res) => {
                console.log(res);
                this.formData = res.data;
            });
            this.editVisible = true;
                /*var i=window.localStorage;
                alert(i["emp"]);
                i["emp"]=JSON.stringify(row);
                this.formData=JSON.parse(i["emp"]);*/
      },
      // 保存修改
      saveEdit() {
        updateRent(this.formData)
        .then((res) => {
          console.log(res.code);
          if (res.code > 0) {
            alert("修改成功");
            this.Show();
          } else {
            alert("修改失败");
            this.Show();
          }
            this.Show();
        });
        this.editVisible = false;
      },
      // 分页大小
      handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
        this.pageSize = val;
        this.Show();
      },
      //分页页码
      handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
        this.pageIndex = val;
        this.Show();
      },
    },
    mounted() {
        this.Show();
    },
};
</script>